package com.commonEncryptionAlgorithms.dissymmetry.ecc;

import org.junit.Test;

import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.PublicKey;

public class Run {
    private static final String eccPublicKeyFilePath = "ECC_public_key.pem";
    private static final String eccPrivateKeyFilePath = "ECC_private_key.pem";

    @Test
    public void test1(){
        boolean b = ECCUtil.generalKey(eccPublicKeyFilePath, eccPrivateKeyFilePath);
        System.out.println(b);
    }

    @Test
    public void test2() throws Exception {
        PublicKey publicKey = ECCUtil.getPublicKey(eccPublicKeyFilePath);
        String str = "hello word";
        String encrypt = ECCUtil.encrypt(str, publicKey);
        System.out.println(encrypt);
    }

    @Test
    public void test3() throws Exception {
        String str = "BPsQlgOVb1iE6A9mNZ4JBPvtWieg2A7TMvZw23r/fL1CpeHE/bd8gFLp++nOHcAZ4elyMxaNoFCy6LEUdhp/BOCMifTY2+ods1IVgtov4uaAKT/KywzlUG7zUsIiWyQ=";
        PrivateKey privateKey = ECCUtil.getPrivateKey(eccPrivateKeyFilePath);
        String decrypt = ECCUtil.decrypt(str, privateKey);
        System.out.println(decrypt);
    }
}
